
lazyopt_ggplot2 <- function(other_parameters, ggp, arg = NULL) {
  opt <- matrix(c(
    "main_style", "ms", 1, "character", "Main style Font:font type:font size:name", "sans:bold.italic:16: :black",
    "xtext_style", "xts", 1, "character", "X text style Font:font type:font size", "sans:bold.italic:11",
    "x_text_positon", "xtp", 1, "character", "split by ':', sample angle:hjust", "60:1",
    "ytext_style", "yts", 1, "character", "Y text style Font:font type:font size", "sans:bold.italic:11",
    "xlab_style", "xls", 1, "character", "X lab style Font:font type:font size:name:color", "sans:bold.italic:14: :black",
    "ylab_style", "yls", 1, "character", "Y lab style Font:font type:font size:name:color", "sans:bold.italic:14: :black",
    "imageSize", "is", 1, "character", "The height and width of the picture", "NULL:NULL",
    "resolution", "dpi", 1, "numeric", "Set the resolution to allow 72,96,300 or 600", "300",
    "imageformt", "if", 1, "character", "pdf,tiff,png", "pdf",
    "imageName", "in", 1, "character", "picture name", "boxplot_p",
    "filepath", "o", 2, "character", "The package path of the output image", "",
    "help", "h", 0, "numeric", "Help document", "1"
  ), byrow = TRUE, ncol = 6) %>%
    rbind(other_parameters, .) %>%
    lazyopt(arg)
  xlab_style <- lazyopt::fenge(opt$xlab_style)
  ylab_style <- lazyopt::fenge(opt$ylab_style)
  main_style <- lazyopt::fenge(opt$main_style)
  xtext_style <- lazyopt::fenge(opt$xtext_style)
  ytext_style <- lazyopt::fenge(opt$ytext_style)
  x_text_positon <- lazyopt::fenge(opt$x_text_positon) %>% as.numeric()
  imageSize <- lazyopt::fenge(opt$imageSize)
  resolution <- match.arg(opt$resolution %>% as.character(), c("72", "96", "300", "600")) %>% as.numeric()
  width <- NA; height <- NA
  if (imageSize[1] != "NULL") { width <- imageSize[1] %>% as.numeric() }
  if (imageSize[2] != "NULL") { height <- imageSize[2] %>% as.numeric() }
  (ggp +
    theme(
      panel.border = element_blank(),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      legend.background = element_blank(),
      axis.text.y = element_text(family = ytext_style[1], face = ytext_style[2], size = as.numeric(ytext_style[3])),
      axis.text.x = element_text(family = xtext_style[1], face = xtext_style[2], size = as.numeric(xtext_style[3]), angle = x_text_positon[1], hjust = x_text_positon[2]),
      axis.title.x = element_text(size = as.numeric(xlab_style[3]), family = xlab_style[1], face = xlab_style[2], colour = xlab_style[5]),
      axis.title.y = element_text(size = as.numeric(ylab_style[3]), family = ylab_style[1], face = ylab_style[2], colour = ylab_style[5]),
      title = element_text(size = as.numeric(main_style[3]), family = main_style[1], face = main_style[2], color = main_style[5])
    ) +
    labs(title = main_style[4], y = ylab_style[4], x = xlab_style[4])) %>%
    ggsave(
      paste0(opt$filepath, "/", opt$imageName, ".", opt$imageformt), ., width = width, height = height, dpi = resolution
    )
}


